const Hapi = require('hapi');
require('env2')('./.env')
const config = require('./config');
const routesHello = require('./routes/hello');
const pluginHapiSwagger = require('./plugins/hapi-swagger');

const server = new Hapi.Server();

server.connection({
  port:config.port,
  host:config.host
});

const init = async () =>{

  await server.register([
    ...pluginHapiSwagger,
  ]);

  server.route([
    ...routesHello,
  ]);

  await server.start();
  console.log(`Server running at:${server.info.uri}`);
};

init();
